package com.atguigu.eduservice.client;

import com.atguigu.commonutils.R;
import com.atguigu.eduservice.client.impl.UserClientImpl;
import com.atguigu.eduservice.entity.UcenterMember;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(name = "service-user", fallback = UserClientImpl.class)
@Component
public interface UserClient {

    @ApiOperation("注册会员")
    @PostMapping("/userservice/ucenter-member/register")
    R register(@RequestBody UcenterMember ucenterMember);

    @ApiOperation("使用账号密码登录")
    @PostMapping("/userservice/ucenter-member/login")
    R login(@RequestBody UcenterMember ucenterMember);

    @ApiOperation("退出登录")
    @PostMapping("/userservice/ucenter-member/logout")
    R logout();

    @ApiOperation("从token中获取信息")
    @PostMapping("/userservice/ucenter-member/getInfo")
    R getInfo();

    @ApiOperation("更新会员信息")
    @PostMapping("/userservice/ucenter-member/updateInfo")
    R updateInfo(@RequestBody UcenterMember ucenterMember);

    @ApiOperation("通过验证码登录")
    @PostMapping("/userservice/ucenter-member/loginByPhone/{phone}/{code}")
    R loginByPhone(@PathVariable("phone") String phone, @PathVariable("code") String code);

    @ApiOperation("/微信登陆")
    @GetMapping("/api/ucenter/wx/login")
    String getCode();

}
